using System;
using System.ComponentModel;

namespace etcetera.Mvc.UI.Toolbar
{
    public class ColumnModel
    {
        [EditorBrowsable(EditorBrowsableState.Never)] //hide from intellisense in fluent interface
        public string Key { get; internal set; }

        [EditorBrowsable(EditorBrowsableState.Never)] //hide from intellisense in fluent interface
        public string FormatString { get; internal set; }

        [EditorBrowsable(EditorBrowsableState.Never)] //hide from intellisense in fluent interface
        public string FormatKey { get; internal set; }

        /// <summary>
        /// A custom format to use when building the cell's value. Any placeholder {0} will be replaced with the columns value.
        /// </summary>
        /// <param name="format">The format string to use</param>
        /// <returns></returns>
        public ColumnModel Format(string format)
        {
            FormatString = format;
            return this;
        }

        /// <summary>
        /// A custom format to use when building the cell's value. Any placeholder {0} will be replaced with the specified field parameter value.
        /// </summary>
        /// <param name="format">The format string to use</param>
        /// <param name="key">The parameter key.</param>
        /// <returns></returns>
        public ColumnModel Format(string format, string key)
        {
            FormatString = format;
            FormatKey = key;
            return this;
        }
    }
}